package org.linlinjava.litemall.core.notify;

import com.cloopen.rest.sdk.CCPRestSmsSDK;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
public class SmsService {

    public void send(String to, String templateId, String[] datas) {
        CCPRestSmsSDK sdk = new CCPRestSmsSDK();
        sdk.init("app.cloopen.com", "8883");
        sdk.setAccount("8aaf070869dc0b880169fac6444e095e", "11dac90fd8704f209a08f01da786bd02");
        sdk.setAppId("8aaf07086bfdc83a016c22d243031752");
        HashMap result = sdk.sendTemplateSMS(to, templateId, datas);
        try {
            if ("000000".equals(result.get("statusCode"))) {
                System.out.println("短信发送成功");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
